However, you can post an Async File Manager call at the time of the interrupt, which would allow you to close or write, assuming you
pre-allocated your memory. If the file manager is busy, it will handle your call later, and your completion routine can chain to the next operation.
There aren't any time limits, but it helps to avoid delaying the system tasks for long periods. Since deferred tasks run at level 0, other interrupts can take priority over them.
Be sure to set up a semaphore system to handle those times when your task is placed in a queue during an interrupt that occurs while it's working.
As an alternative, you can make use of the Notification Manager by queuing a notification task that has no icon, string, etc. to run at the next systemtask time. This gives you a good A5 space where you can work with files, dialogs, memory, or whatever else you need. The following sample code should help you determine how to do this:
NMRec NM; /* Notification Mgr Block */ NM.qType = nmType; NM.Icon = nil; NM.Sound = nil; NM.Mark = nil; NM.Str = nil NM.nmResp = &YourHandler; NM.nmRefCon = your globals; NMInstall(&NM); .... YourHandler(NMRec * nmP) { globals = nmP->nmRefCon; ... do whatever ... NMRemove(nmP); }